package com.niit.activity4_6.controller;

import com.niit.activity4_6.model.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.niit.activity4_6.service.EmployeeService;

import java.util.List;

@RestController
public class EmployeeController {
    @Autowired
    EmployeeService employeeService;

    @GetMapping("/emp/{id}")
    public Employee getEmp(@PathVariable("id") Integer id) {
        return employeeService.findOneById(id);
    }

    @GetMapping("/emps")
    public List<Employee> findAllEmps() {
        return employeeService.findAll();
    }
}